<template>
  <el-card class="form-container" shadow="never">
    <el-steps :active="active" finish-status="success" align-center style="margin-top: 30px">
      <el-step title="商品基本信息"></el-step>
      <el-step title="商品详情信息"></el-step>
      <el-step title="商品属性配置"></el-step>
      <!--      <el-step title="选择商品关联"></el-step>-->
    </el-steps>
    <Goods-info-detail
      v-show="showStatus[0]"
      v-model="form"
      :is-edit="isAudit"
      @nextStep="nextStep">
    </Goods-info-detail>
    <Goods-content-detail
      v-show="showStatus[1]"
      v-model="form"
      :is-edit="isAudit"
      @nextStep="nextStep"
      @prevStep="prevStep">
    </Goods-content-detail>
    <Goods-attr-detail
      v-show="showStatus[2]"
      v-model="form"
      :is-edit="isAudit"
      @prevStep="prevStep">
    </Goods-attr-detail>
  </el-card>
</template>
<script>
import GoodsInfoDetail from './goodsInfoDetail';
import GoodsContentDetail from './goodsContentDetail';
import GoodsAttrDetail from './goodsAttrDetail';
import {getGoods} from "@/api/supplier/goodsAudit";
import step from "@/mixins/step";

const defaultProductForm = {
  goodsId: undefined,
  catId: undefined,
  goodsName: undefined,
  goodsCode: undefined,
  img: undefined,
  tmpImg: undefined,
  video: undefined,
  videoUrl: undefined,
  description: undefined,
  content: undefined,
  brandId: undefined,
  isShow: undefined,
  isTop: undefined,
  isSale: undefined,
  isDiscount: undefined,
  sort: undefined,
  clicknum: undefined,
  oldPrice: undefined,
  costPrice: undefined,
  price: undefined,
  profitRatio: undefined,
  commissionRatio: undefined,
  postage: undefined,
  inventory: 1000,
  givePoint: 0,
  deductionPoint: 0,
  isSku: undefined,
  skuStr: undefined,
  salesVolume: undefined,
  virtualVolume: undefined,
  createtime: undefined,
  isDelete: undefined,
  type: undefined,
  bigPrice: undefined,
  proffer: undefined,
  fhSmall: undefined,
  sxSmall: undefined,
  supplierId: undefined,
  banNum: undefined,
  inteBili: undefined,
  skuStockList: []
};
export default {
  name: 'GoodsDetail',
  components: {GoodsInfoDetail, GoodsContentDetail,GoodsAttrDetail},
  props: {
    isAudit: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      form: Object.assign({}, defaultProductForm),
      showStatus: [true, false,false]
    }
  },
  mixins: [step],
  created() {
    if (this.isAudit) {
      getGoods(this.$route.query.id).then(response => {
        this.form = response.data;
      });
    }
  },
  methods: {

  }
}
</script>
<style>
.form-container {
  width: 860px;
  margin-top: 15px;
}

.form-inner-container {
  width: 800px;
}
</style>


